<?php
namespace Home\Controller;

/**
 * 教程页面 控制器
 * @author liubo <liubo@ilongyuan.com.cn>
 */
class CourseController extends HomeController
{
    private $eventObj;
    public function _initialize() {
        parent::_initialize();
        $this->eventObj = event('Course');
        C('DEFAULT_THEME', 'ui2');
    }

    public function index($id = 0) {
        if (empty($id) || !is_numeric($id)) {
            $this->error('参数有误');
        }
        $course = $this->eventObj->detail(intval($id));
        if (empty($course)) {
            $this->error('参数有误');
        }
        $this->course = $course;
        if (IS_MOBILE) {
            return $this->display('mobile');
        }
        $this->display();
    }
}